﻿///Name:ClientsAccess类
///Author: 张仪
///Description: 
///Company:河南企汇网信息技术有限公司
///DateTime:2012/7/14 9:46:00



using System;
using System.Data ;

using Model.Data;
using DataAccess;
using BusinessLogic.BusinessRules ;
using BusinessLogic.ClassFactory ;

namespace BusinessLogic.BusinessRules
{
	/// <summary>
	/// Clients 的摘要说明。
	/// </summary>
	public class Clients:BaseClass
	{
		#region 必有属性
		public Model.Data.ClientsData.ClientsRow DataItem
		{
			get
			{				
				return (Model.Data.ClientsData.ClientsRow)base.m_CurrentRow;
			}
			set
			{
				base.m_CurrentRow=value;
			}
		}

		private Model.Data.ClientsData m_Data
		{
			get
			{				
				return (Model.Data.ClientsData)base.m_DataSet;
			}
			set
			{
				base.m_DataSet=value;
			}
		}


		public override int Count
		{
			get
			{
				return this.m_Data.Clients.Count;
			}
		}
		#endregion

		#region 构造函数
		public Clients(DataAccess.DBManager  m_DBManager,DataAccess.BaseAccess m_Access):base(m_DBManager,m_Access)
		{
		}
		#endregion

		#region 必须重载方法
		/// <summary>
		/// 根据数据集中索引,设置当前数据行
		/// </summary>
		/// <param name="n_index">数据集中的索引</param>
		public override void SelectRow(int n_index)
		{					

			if( m_Data!=null&&m_Data.Clients.Rows.Count >n_index)
			{
				DataItem=m_Data.Clients[n_index];
			}
		}


		/// <summary>
		/// 实现更新
		/// </summary>
		/// <returns></returns>
		protected override int OnUpdate()
		{
			return m_Access.Update(this.m_DataSet);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="ID"></param>
		/// <returns></returns>
		protected override bool OnDelete(int ID)
		{	
			return true ;		
		}


		public override void NewDataSet()
		{

			this.m_Data = new ClientsData();
			m_CurrentRow=m_Data.Clients.NewClientsRow();
		}

		public override void SetDataSet(DataSet m_DataSet)
		{
			this.m_DataSet=m_DataSet;
		}

		public override bool OnInsert()
		{				
            this.DataItem.intClientsID = this.GetNextSeed();
            this.m_Data.Clients.Rows.Add(this.m_CurrentRow);
            return true;
		}
		#endregion

		#region 业务属性
		public Model.Data.ClientsData Data
		{
			get
			{				
				return (Model.Data.ClientsData)base.m_DataSet;
			}
			set
			{
				base.m_DataSet=value;
			}
		}
		#endregion
	}
}
